package io.r2mo.test.common.controller.gen.productcat;

import io.r2mo.test.common.domain.ProductCatEntity;
import io.r2mo.typed.common.Pagination;
import io.r2mo.typed.webflow.R;
import io.r2mo.typed.json.JObject;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * ProductCat Controller接口
 * </p>
 *
 * @author lang
 * @since 2025-09-22
 */
@Tag(name = "商品分类", description = "商品分类相关API接口")
public interface ProductCatCrudController {

    @PostMapping("")
    @Operation(summary = "创建商品分类", description = "管理端/创建商品分类")
    R<ProductCatCommonResponse> createSingle(@Valid @RequestBody ProductCatCommonRequest request);


    @PutMapping("/{id}")
    @Operation(summary = "更新商品分类", description = "管理端/更新商品分类")
    R<ProductCatCommonResponse> updateSingle(@PathVariable("id") String id,
                                               @Valid @RequestBody ProductCatCommonRequest request);

    @GetMapping("/{id}")
    @Operation(summary = "获取商品分类详情", description = "管理端/获取商品分类详情")
    R<ProductCatEntity> findSingle(@PathVariable("id") String id);

    @DeleteMapping("/{id}")
    @Operation(summary = "删除商品分类", description = "管理端/删除商品分类")
    R<Boolean> removeSingle(@PathVariable("id") String id);

    @PostMapping("/search")
    @Operation(summary = "分页查询商品分类", description = "管理端/分页查询商品分类")
    R<Pagination<ProductCatEntity>> findPage(@RequestBody JObject query);

    @GetMapping("/all")
    @Operation(summary = "查询所有商品分类", description = "管理端/查询所有商品分类")
    R<List<ProductCatEntity>> findAll();

    @PostMapping("/import")
    @Operation(summary = "导入商品分类", description = "管理端/导入商品分类")
    R<Boolean> uploadData(@RequestPart("file") MultipartFile file,
                          @RequestPart("config") JObject config);

    @PostMapping("/export")
    @Operation(summary = "导出商品分类", description = "管理端/导出商品分类")
    void downloadBy(@RequestBody JObject query);
}
